
(function(window,document,Laya){
	var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;

	var BaseCamera=laya.d3.core.BaseCamera,BaseMaterial=laya.d3.core.material.BaseMaterial,BoxMesh=laya.d3.resource.models.BoxMesh;
	var Camera=laya.d3.core.Camera,Color=laya.d3.math.Color,Component=laya.components.Component,ConeMesh=laya.d3.resource.models.ConeMesh;
	var Event=laya.events.Event,Handler=laya.utils.Handler,IDEAPIS=laya.ide.managers.IDEAPIS,KeyBoardManager=laya.events.KeyBoardManager;
	var Keyboard=laya.events.Keyboard,Matrix4x4$1=laya.d3.math.Matrix4x4,Mesh=laya.d3.resource.models.Mesh,MeshSprite3D=laya.d3.core.MeshSprite3D;
	var Node=laya.display.Node,PixelLineMaterial=laya.d3.core.pixelLine.PixelLineMaterial,PixelLineSprite3D=laya.d3.core.pixelLine.PixelLineSprite3D;
	var PrimitiveMesh=laya.d3.resource.models.PrimitiveMesh,Quaternion$1=laya.d3.math.Quaternion,Render=laya.renders.Render;
	var RenderState=laya.d3.core.material.RenderState,Scene3D=laya.d3.core.scene.Scene3D,Script3D=laya.d3.component.Script3D;
	var Shader3D=laya.d3.shader.Shader3D,Sprite3D=laya.d3.core.Sprite3D,Transform3D=laya.d3.core.Transform3D;
	var Tween=laya.utils.Tween,Utils=laya.utils.Utils,Vector3$1=laya.d3.math.Vector3,Vector4$1=laya.d3.math.Vector4;
	var VertexBuffer3D=laya.d3.graphics.VertexBuffer3D,VertexMesh=laya.d3.graphics.Vertex.VertexMesh;
	/**
	*...
	*@author
	*/
	//class laya.d3Editor.EditerScene3D
	var EditerScene3D=(function(){
		function EditerScene3D(scene){
			this._scene=null;
			this._transformSprite3D=null;
			;
			this._scene=scene;
			this._transformSprite3D=new TransformSprite3D();
			this._scene.addChild(this.transformSprite3D);
		}

		__class(EditerScene3D,'laya.d3Editor.EditerScene3D');
		var __proto=EditerScene3D.prototype;
		__getset(0,__proto,'scene',function(){
			return this._scene;
		});

		__getset(0,__proto,'transformSprite3D',function(){
			return this._transformSprite3D;
		});

		return EditerScene3D;
	})()


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.component.EditerCameraScript extends laya.d3.component.Script3D
	var EditerCameraScript=(function(_super){
		function EditerCameraScript(){
			this.lastMouseX=NaN;
			this.lastMouseY=NaN;
			this.isRightMouseDown=false;
			this.isMouseDown=false;
			this.rotaionSpeed=0.00006;
			this.translationSpeed=0.006;
			this.camera=null;
			this.speed=0.01;
			this.isWheel=0;
			this.isMove=false;
			this.scene=null;
			this._movePosition=null;
			this._offSpeed=0;
			this.isKeyDown=false;
			this.isWheelDown=false;
			this.saveCameraInfoHandler=null;
			this.mouseWhellDownHandler=null;
			this.mouseWhellUpHandler=null;
			this.updateWorldCentreDistance=null;
			this.worldCentreDistance=NaN;
			this._onWheelDown=null;
			this._onWheelUp=null;
			EditerCameraScript.__super.call(this);
			this._tempVector3=new Vector3$1();
			this.yawPitchRoll=new Vector3$1();
			this.resultRotation=new Quaternion$1();
			this.tempRotationZ=new Quaternion$1();
			this.tempRotationX=new Quaternion$1();
			this.tempRotationY=new Quaternion$1();
			this._worldCentre=new Vector3$1();
			EditerCameraScript.isSelect=false;
		}

		__class(EditerCameraScript,'laya.d3Editor.component.EditerCameraScript',_super);
		var __proto=EditerCameraScript.prototype;
		__proto._onAdded=function(){
			if(!this._onWheelDown)
				this._onWheelDown=Utils.bind(this.onWheelDown,this);
			if(!this._onWheelUp)
				this._onWheelUp=Utils.bind(this.onWheelUp,this);
			Render.canvas.addEventListener('mousedown',this._onWheelDown);
			Render.canvas.addEventListener('mouseup',this._onWheelUp);
			Laya.stage.on("mousedown",this,this.mouseDown);
			Laya.stage.on("mouseup",this,this.mouseUp);
			Laya.stage.on("rightmousedown",this,this.rightMouseDown);
			Laya.stage.on("rightmouseup",this,this.rightMouseUp);
			Laya.stage.on("mousewheel",this,this.mouseWheel);
			this.camera=this.owner;
		}

		__proto._onDestroy=function(){
			_super.prototype._onDestroy.call(this);
			if(this._onWheelDown)
				Render.canvas.removeEventListener('mousedown',this._onWheelDown);
			if(this._onWheelUp)
				Render.canvas.removeEventListener('mouseup',this._onWheelUp);
			Laya.stage.off("mousedown",this,this.mouseDown);
			Laya.stage.off("mouseup",this,this.mouseUp);
			Laya.stage.off("rightmousedown",this,this.rightMouseDown);
			Laya.stage.off("rightmouseup",this,this.rightMouseUp);
			Laya.stage.off("mousewheel",this,this.mouseWheel);
		}

		__proto.onUpdate=function(){
			_super.prototype.onUpdate.call(this);
			this.updateCamera(Laya.timer.delta);
			var transformSprite3d=this.scene.transformSprite3D;
			var distance=Vector3$1.distance(this.camera.transform.position,transformSprite3d.transform.position);
			this._tempVector3.x=this._tempVector3.y=this._tempVector3.z=distance *0.25;
			transformSprite3d.transform.scale=this._tempVector3;
		}

		__proto.onKeyDown=function(e){
			if (EditerCameraScript.isSelect)
				return
			this.isKeyDown=true;
		}

		__proto.onKeyUp=function(e){
			if(EditerCameraScript.isSelect||
				KeyBoardManager.hasKeyDown(87)||
			KeyBoardManager.hasKeyDown(83)||
			KeyBoardManager.hasKeyDown(65)||
			KeyBoardManager.hasKeyDown(68)||
			KeyBoardManager.hasKeyDown(81)||
			KeyBoardManager.hasKeyDown(69))
			return
			this.isKeyDown=false;
			this.speed=0.01;
			this.offSpeed=0;
		}

		__proto.onWheelDown=function(e){
			if (e.button==1 && EditerCameraScript.isSelect){
				console.log('滚轮按下');
				this.isWheelDown=true;
				this.lastMouseX=Laya.stage.mouseX;
				this.lastMouseY=Laya.stage.mouseY;
				this.mouseWhellDownHandler && this.mouseWhellDownHandler.run();
			}
		}

		__proto.onWheelUp=function(e){
			if (e.button==1 && EditerCameraScript.isSelect){
				console.log('滚轮抬起');
				this.isWheelDown=false;
				this.mouseWhellUpHandler && this.mouseWhellUpHandler.run();
			}
		}

		__proto.rightMouseDown=function(e){
			if (!EditerCameraScript.isSelect || this.isWheelDown)
				return
			this.camera.transform.localRotation.getYawPitchRoll(this.yawPitchRoll);
			this.lastMouseX=Laya.stage.mouseX;
			this.lastMouseY=Laya.stage.mouseY;
			this.isRightMouseDown=true;
		}

		__proto.rightMouseUp=function(e){
			if (!EditerCameraScript.isSelect)
				return
			this.isRightMouseDown=false;
			this.saveCameraInfoHandler && this.saveCameraInfoHandler.run();
			this.speed=0.01;
			this.offSpeed=0;
		}

		__proto.mouseDown=function(e){
			if (!EditerCameraScript.isSelect)
				return
			if (e.altKey){
				Vector3$1.scale(this.camera.transform.forward,this.worldCentreDistance,this._worldCentre);
				Vector3$1.add(this.camera.transform.position,this._worldCentre,this._worldCentre);
			}
			this.lastMouseX=Laya.stage.mouseX;
			this.lastMouseY=Laya.stage.mouseY;
			this.isMouseDown=true;
		}

		__proto.mouseUp=function(e){
			if (!EditerCameraScript.isSelect)
				return
			this.isMouseDown=false;
			this.saveCameraInfoHandler && this.saveCameraInfoHandler.run();
			this.speed=0.01;
			this.offSpeed=0;
		}

		__proto.mouseWheel=function(e){
			if (!EditerCameraScript.isSelect)
				return
			this.isWheel=e.delta;
		}

		/**
		*向前移动。
		*@param distance 移动距离。
		*/
		__proto.moveForward=function(distance){
			this._tempVector3.elements[0]=this._tempVector3.elements[1]=0;
			this._tempVector3.elements[2]=distance;
			this.camera.transform.translate(this._tempVector3);
			this.updateWorldCentreDistance && this.updateWorldCentreDistance.runWith(this.worldCentreDistance+distance);
		}

		/**
		*向右移动。
		*@param distance 移动距离。
		*/
		__proto.moveRight=function(distance){
			this._tempVector3.elements[1]=this._tempVector3.elements[2]=0;
			this._tempVector3.elements[0]=distance;
			this.camera.transform.translate(this._tempVector3);
		}

		/**
		*向上移动。
		*@param distance 移动距离。
		*/
		__proto.moveVertical=function(distance){
			this._tempVector3.elements[0]=this._tempVector3.elements[2]=0;
			this._tempVector3.elements[1]=distance;
			this.camera.transform.translate(this._tempVector3);
		}

		__proto.updateCamera=function(elapsedTime){
			var distance=NaN;
			var offsetY=NaN;
			var offsetX=NaN;
			offsetX=Laya.stage.mouseX-this.lastMouseX;
			offsetY=Laya.stage.mouseY-this.lastMouseY;
			if (this.isWheelDown || (EditerCameraScript.isTranslationPattern && this.isMouseDown && !this.isKeyDown)){
				distance=(this.worldCentreDistance / 1000);
				this._tempVector3.elements[0]=-offsetX *distance;
				this._tempVector3.elements[1]=offsetY *distance;
				this._tempVector3.elements[2]=0;
				this.camera.transform.translate(this._tempVector3);
			}
			if (this.isRightMouseDown || this.isMouseDown){
				this.offSpeed+=0.0001;
				this.speed=this.offSpeed;
				var yprElem=this.yawPitchRoll.elements;
				if (this.isRightMouseDown){
					yprElem[0]-=offsetX *this.rotaionSpeed *elapsedTime;
					yprElem[1]-=offsetY *this.rotaionSpeed *elapsedTime;
					KeyBoardManager.hasKeyDown(87)&& this.moveForward(-this.speed *elapsedTime);
					KeyBoardManager.hasKeyDown(83)&& this.moveForward(this.speed *elapsedTime);
					KeyBoardManager.hasKeyDown(65)&& this.moveRight(-this.speed *elapsedTime);
					KeyBoardManager.hasKeyDown(68)&& this.moveRight(this.speed *elapsedTime);
					KeyBoardManager.hasKeyDown(81)&& this.moveVertical(this.speed *elapsedTime);
					KeyBoardManager.hasKeyDown(69)&& this.moveVertical(-this.speed *elapsedTime);
					this.updateRotation();
				}
				if (this.isKeyDown && this.isMouseDown && KeyBoardManager.hasKeyDown(18)){
					yprElem[0]-=offsetX *this.rotaionSpeed *elapsedTime *8;
					yprElem[1]-=offsetY *this.rotaionSpeed *elapsedTime *8;
					this.updateRotation();
					Vector3$1.scale(this.camera.transform.forward,this.worldCentreDistance,this._tempVector3);
					Vector3$1.subtract(this._worldCentre,this._tempVector3,this._tempVector3);
					this.camera.transform.position=this._tempVector3;
				}
			}
			if (this.isWheel){
				distance=this.worldCentreDistance / 100;
				if (distance <=0.001)
					distance=0.001
				if (this.isWheel > 0){
					this.moveForward(-distance *elapsedTime);
					}else {
					this.moveForward(distance *elapsedTime);
				}
				this.isWheel=0;
				this.saveCameraInfoHandler && this.saveCameraInfoHandler.run();
			}
			if (this.isMove){
				this.camera.transform.position=this._movePosition;
				this.saveCameraInfoHandler && this.saveCameraInfoHandler.run();
			}
			this.lastMouseX=Laya.stage.mouseX;
			this.lastMouseY=Laya.stage.mouseY;
		}

		__proto.updateRotation=function(){
			var yprElem=this.yawPitchRoll.elements;
			if (Math.abs(yprElem[1])< 1.50){
				Quaternion$1.createFromYawPitchRoll(yprElem[0],yprElem[1],yprElem[2],this.tempRotationZ);
				this.tempRotationZ.cloneTo(this.camera.transform.localRotation);
				this.camera.transform.localRotation=this.camera.transform.localRotation;
			}
		}

		__proto.focusCamera=function(x,y,z){
			var _$this=this;
			this.isMove=true;
			this._movePosition=this.camera.transform.position;
			Tween.to(this._movePosition,{x:x,y:y,z:z},200,null,Handler.create(this,function(){
				Laya.timer.frameOnce(1,this,function(){
					_$this.isMove=false;
				});
			}));
		}

		__proto._cloneTo=function(dest){
			laya.components.Component.prototype._cloneTo.call(this,dest);
			(dest).scene=this.scene;
		}

		__getset(0,__proto,'offSpeed',function(){
			return this._offSpeed;
			},function(value){
			if (value >=1.5)
				value=1.5;
			this._offSpeed=value;
		});

		EditerCameraScript.isSelect=false;
		EditerCameraScript.isTranslationPattern=false;
		return EditerCameraScript;
	})(Script3D)


	/**
	*盒子
	*@author wzy
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerBoxColliderShape extends laya.d3.core.Sprite3D
	var EditerBoxColliderShape=(function(_super){
		function EditerBoxColliderShape(){
			this._center=null;
			this._size=null;
			this._boxShapeLine=null;
			EditerBoxColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
			this._size=new Vector3$1(1,1,1);
			this._boxShapeLine=this.addChild(new BoxShapeLine3D(this._size.x,this._size.y,this._size.z));
		}

		__class(EditerBoxColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerBoxColliderShape',_super);
		var __proto=EditerBoxColliderShape.prototype;
		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.size){
				this.size.fromArray(data.size);
				this.size=this.size;
			}
		}

		__getset(0,__proto,'size',function(){
			return this._size;
			},function(value){
			this._size=value;
			this._boxShapeLine.long=value.x;
			this._boxShapeLine.height=value.y;
			this._boxShapeLine.width=value.z;
		});

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			this._center.cloneTo(this._boxShapeLine.transform.localPosition);
			this._boxShapeLine.transform.localPosition=this._boxShapeLine.transform.localPosition;
		});

		return EditerBoxColliderShape;
	})(Sprite3D)


	/**
	*胶囊
	*@author wzy
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerCapsuleColliderShape extends laya.d3.core.Sprite3D
	var EditerCapsuleColliderShape=(function(_super){
		function EditerCapsuleColliderShape(){
			this._center=null;
			this._radius=NaN;
			this._height=NaN;
			this._capsuleShapeLine=null;
			EditerCapsuleColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
			this._radius=0.5;
			this._height=2.0;
			this._capsuleShapeLine=this.addChild(new CapsuleShapeLine3D(this._radius,this._height));
		}

		__class(EditerCapsuleColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerCapsuleColliderShape',_super);
		var __proto=EditerCapsuleColliderShape.prototype;
		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.radius){
				this.radius=data.radius;
			}
			if (data.height){
				this.height=data.height;
			}
		}

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			this._center.cloneTo(this._capsuleShapeLine.transform.localPosition);
			this._capsuleShapeLine.transform.localPosition=this._capsuleShapeLine.transform.localPosition;
		});

		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			this._radius=value;
			this._capsuleShapeLine.radius=value;
		});

		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			this._height=value;
			this._capsuleShapeLine.height=value;
		});

		return EditerCapsuleColliderShape;
	})(Sprite3D)


	/**
	*...
	*@author zyh
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerConeColliderShape extends laya.d3.core.Sprite3D
	var EditerConeColliderShape=(function(_super){
		function EditerConeColliderShape(){
			this._center=null;
			this._radius=NaN;
			this._height=NaN;
			this._cylinderShapeLine=null;
			EditerConeColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
			this._radius=0.5;
			this._height=1.0;
			this._cylinderShapeLine=this.addChild(new ConeShapeLine3D(this._radius,this._height));
		}

		__class(EditerConeColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerConeColliderShape',_super);
		var __proto=EditerConeColliderShape.prototype;
		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.radius){
				this.radius=data.radius;
			}
			if (data.height){
				this.height=data.height;
			}
		}

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			this._center.cloneTo(this._cylinderShapeLine.transform.localPosition);
			this._cylinderShapeLine.transform.localPosition=this._cylinderShapeLine.transform.localPosition;
		});

		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			this._radius=value;
			this._cylinderShapeLine.radius=value;
		});

		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			this._height=value;
			this._cylinderShapeLine.height=value;
		});

		return EditerConeColliderShape;
	})(Sprite3D)


	/**
	*圆柱
	*@author zyh
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerCylinderColliderShape extends laya.d3.core.Sprite3D
	var EditerCylinderColliderShape=(function(_super){
		function EditerCylinderColliderShape(){
			this._center=null;
			this._radius=NaN;
			this._height=NaN;
			this._cylinderShapeLine=null;
			EditerCylinderColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
			this._radius=0.5;
			this._height=2.0;
			this._cylinderShapeLine=this.addChild(new CylinderShapeLine3D(this._radius,this._height));
		}

		__class(EditerCylinderColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerCylinderColliderShape',_super);
		var __proto=EditerCylinderColliderShape.prototype;
		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.radius){
				this.radius=data.radius;
			}
			if (data.height){
				this.height=data.height;
			}
		}

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			this._center.cloneTo(this._cylinderShapeLine.transform.localPosition);
			this._cylinderShapeLine.transform.localPosition=this._cylinderShapeLine.transform.localPosition;
		});

		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			this._radius=value;
			this._cylinderShapeLine.radius=value;
		});

		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			this._height=value;
			this._cylinderShapeLine.height=value;
		});

		return EditerCylinderColliderShape;
	})(Sprite3D)


	/**
	*...
	*@author zyh
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerMeshColliderShape extends laya.d3.core.Sprite3D
	var EditerMeshColliderShape=(function(_super){
		function EditerMeshColliderShape(){
			this._center=null;
			this._mesh='';
			this._meshShapeLine3D=null;
			EditerMeshColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
		}

		__class(EditerMeshColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerMeshColliderShape',_super);
		var __proto=EditerMeshColliderShape.prototype;
		__proto.onLoaded=function(e){
			var ibBufferData=e._indexBuffer ? e._indexBuffer.getData():(e)._primitveGeometry._indexBuffer.getData();
			this._meshShapeLine3D=this.addChild(new MeshShapeLine3D(ibBufferData.length));
			this._meshShapeLine3D.mesh=this._mesh;
			this._center.cloneTo(this._meshShapeLine3D.transform.localPosition);
			this._meshShapeLine3D.transform.localPosition=this._meshShapeLine3D.transform.localPosition;
		}

		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.mesh){
				this.mesh=data.mesh;
			}
		}

		__getset(0,__proto,'mesh',function(){
			return this._mesh;
			},function(value){
			if (this._mesh !=value){
				this._mesh=value;
				if (this._meshShapeLine3D){
					this._meshShapeLine3D.destroy();
					this._meshShapeLine3D=null;
				}
				Mesh.load(IDEAPIS.assetsPath+'/'+value,Handler.create(this,this.onLoaded));
			}
		});

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			if (this._meshShapeLine3D){
				this._center.cloneTo(this._meshShapeLine3D.transform.localPosition);
				this._meshShapeLine3D.transform.localPosition=this._meshShapeLine3D.transform.localPosition;
			}
		});

		return EditerMeshColliderShape;
	})(Sprite3D)


	/**
	*球
	*@author wzy
	*/
	//class laya.d3Editor.component.physics.EditerColliderShape.EditerSphereColliderShape extends laya.d3.core.Sprite3D
	var EditerSphereColliderShape=(function(_super){
		function EditerSphereColliderShape(){
			this._center=null;
			this._radius=NaN;
			this._sphereShapeLine=null;
			EditerSphereColliderShape.__super.call(this);
			this._center=new Vector3$1(0,0,0);
			this._radius=0.5;
			this._sphereShapeLine=this.addChild(new SphereShapeLine3D(this._radius));
		}

		__class(EditerSphereColliderShape,'laya.d3Editor.component.physics.EditerColliderShape.EditerSphereColliderShape',_super);
		var __proto=EditerSphereColliderShape.prototype;
		__proto._parse=function(data){
			if (data.center){
				this.center.fromArray(data.center);
				this.center=this.center;
			}
			if (data.radius){
				this.radius=data.radius;
			}
		}

		__getset(0,__proto,'center',function(){
			return this._center;
			},function(value){
			if ((value instanceof Array))
				this._center.fromArray(value)
			else
			this._center=value;
			this._center.cloneTo(this._sphereShapeLine.transform.localPosition);
			this._sphereShapeLine.transform.localPosition=this._sphereShapeLine.transform.localPosition;
		});

		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			this._radius=value;
			this._sphereShapeLine.radius=value;
		});

		return EditerSphereColliderShape;
	})(Sprite3D)


	/**
	*...
	*@author ...
	*/
	//class laya.d3Editor.component.physics.EditerPhysicsCollider extends laya.d3.core.Sprite3D
	var EditerPhysicsCollider=(function(_super){
		function EditerPhysicsCollider(){
			EditerPhysicsCollider.__super.call(this);
		}

		__class(EditerPhysicsCollider,'laya.d3Editor.component.physics.EditerPhysicsCollider',_super);
		var __proto=EditerPhysicsCollider.prototype;
		__proto._parse=function(data){}
		return EditerPhysicsCollider;
	})(Sprite3D)


	/**
	*...
	*@author ...
	*/
	//class laya.d3Editor.component.physics.EditerRigidbody3D extends laya.d3.core.Sprite3D
	var EditerRigidbody3D=(function(_super){
		function EditerRigidbody3D(){
			EditerRigidbody3D.__super.call(this);
		}

		__class(EditerRigidbody3D,'laya.d3Editor.component.physics.EditerRigidbody3D',_super);
		var __proto=EditerRigidbody3D.prototype;
		__proto._parse=function(data){}
		return EditerRigidbody3D;
	})(Sprite3D)


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.TransformSprite3D extends laya.d3.core.Sprite3D
	var TransformSprite3D=(function(_super){
		function TransformSprite3D(){
			this.positionSprite3D=null;
			this.positionX=null;
			this.positionY=null;
			this.positionZ=null;
			this.rotationSprite3D=null;
			this.rotationX=null;
			this.rotationY=null;
			this.rotationZ=null;
			this.rotationS=null;
			this.rotationL=null;
			this.scaleSprite3D=null;
			this.scalingX=null;
			this.scalingY=null;
			this.scalingZ=null;
			this.selectSprite3D=null;
			this.curCamera=null;
			TransformSprite3D.__super.call(this);
			this.color=new Color(1,1,1,1);
			this.colorX=new Color(1,0,0,0);
			this.colorY=new Color(0,1,0,0);
			this.colorZ=new Color(0,0,1,0);
			this.selectColor=new Vector4$1(1,0.92,0.016,0);
			this._mat=new Matrix4x4$1();
			this._position=new Vector3$1();
			this._rotation=new Quaternion$1();
			this._scale=new Vector3$1();
			var _$this=this;
			this.name="Transform3D";
			this.active=false;
			GizmoMaterial.initShader();
			DepthCullLineMaterial.initShader();
			this.initPositionSprite3D();
			this.initRotationSprite3D();
			this.initScaleSprite3D();
			this.positionSprite3D.active=true;
			this.rotationSprite3D.active=false;
			this.scaleSprite3D.active=false;
			Laya.timer.loop(1,this,function(){
				if (_$this.curCamera && _$this.active && _$this.rotationSprite3D.active){
					var cameraTransform=_$this.curCamera.transform;
					var cameraRight=cameraTransform.right;
					var cameraUp=cameraTransform.up;
					var cameraForward=cameraTransform.forward;
					var mate=_$this._mat.elements;
					mate[0]=cameraRight.x;
					mate[1]=cameraRight.y;
					mate[2]=cameraRight.z;
					mate[4]=cameraUp.x;
					mate[5]=cameraUp.y;
					mate[6]=cameraUp.z;
					mate[8]=cameraForward.x;
					mate[9]=cameraForward.y;
					mate[10]=cameraForward.z;
					_$this._mat.decomposeTransRotScale(_$this._position,_$this._rotation,_$this._scale);
					_$this.rotationS.transform.rotation=_$this.rotationL.transform.rotation=_$this._rotation;
				}
			});
		}

		__class(TransformSprite3D,'laya.d3Editor.TransformSprite3D',_super);
		var __proto=TransformSprite3D.prototype;
		__proto.initPositionSprite3D=function(){
			this.positionSprite3D=this.addChild(new Sprite3D());
			this.initPositionXSprite3D();
			this.initPositionYSprite3D();
			this.initPositionZSprite3D();
		}

		__proto.initRotationSprite3D=function(){
			this.rotationSprite3D=this.addChild(new Sprite3D());
			this.initRotationSSprite3D();
			this.initRotationLSprite3D();
			this.initRotationXSprite3D();
			this.initRotationYSprite3D();
			this.initRotationZSprite3D();
		}

		__proto.initScaleSprite3D=function(){
			this.scaleSprite3D=this.addChild(new Sprite3D());
			this.initScaleXSprite3D();
			this.initScaleYSprite3D();
			this.initScaleZSprite3D();
		}

		__proto.initPositionXSprite3D=function(){
			this.positionX=this.positionSprite3D.addChild(new Sprite3D());
			var line=this.positionX.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.color=this.colorX;
			lm.renderQueue=4999;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='PositionX';
			var cone=this.positionX.addChild(new MeshSprite3D(new ConeMesh(0.04,0.125)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.colorX;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='PositionX';
			this.positionX.transform.rotate(new Vector3$1(0,0,-90),true,false);
		}

		__proto.initPositionYSprite3D=function(){
			this.positionY=this.positionSprite3D.addChild(new Sprite3D());
			var line=this.positionY.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.color=this.colorY;
			lm.renderQueue=4999;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='PositionY';
			var cone=this.positionY.addChild(new MeshSprite3D(new ConeMesh(0.04,0.125)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.colorY;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='PositionY';
		}

		//cone.transformType=2;
		__proto.initPositionZSprite3D=function(){
			this.positionZ=this.positionSprite3D.addChild(new Sprite3D());
			var line=this.positionZ.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.color=this.colorZ;
			lm.renderQueue=4999;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='PositionZ';
			var cone=this.positionZ.addChild(new MeshSprite3D(new ConeMesh(0.04,0.125)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.colorZ;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='PositionZ';
			this.positionZ.transform.rotate(new Vector3$1(90,0,0),true,false);
		}

		__proto.initRotationSSprite3D=function(){
			this.rotationS=this.rotationSprite3D.addChild(new PixelLineSprite3D(64));
			this.drawAxisZCircle(this.rotationS,0.5,this.color);
			var lm=new PixelLineMaterial();
			lm.renderQueue=5001;
			lm.getRenderState(0).depthTest=0x0207;
			this.rotationS.pixelLineRenderer.sharedMaterial=lm;
		}

		__proto.initRotationLSprite3D=function(){
			this.rotationL=this.rotationSprite3D.addChild(new PixelLineSprite3D(64));
			this.drawAxisZCircle(this.rotationL,0.56,this.color);
			var lm=new PixelLineMaterial();
			lm.renderQueue=5001;
			lm.getRenderState(0).depthTest=0x0207;
			this.rotationL.pixelLineRenderer.sharedMaterial=lm;
		}

		__proto.initRotationXSprite3D=function(){
			this.rotationX=this.rotationSprite3D.addChild(new PixelLineSprite3D(64));
			this.drawAxisXCircle(this.rotationX,0.5,this.color);
			var lm=new DepthCullLineMaterial();
			lm.color=this.colorX;
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			this.rotationX.pixelLineRenderer.sharedMaterial=lm;
			this.rotationX.name='RotationX';
		}

		//rotationX.transformType=4;
		__proto.initRotationYSprite3D=function(){
			this.rotationY=this.rotationSprite3D.addChild(new PixelLineSprite3D(64));
			this.drawAxisYCircle(this.rotationY,0.5,this.color);
			var lm=new DepthCullLineMaterial();
			lm.color=this.colorY;
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			this.rotationY.pixelLineRenderer.sharedMaterial=lm;
			this.rotationY.name='RotationY';
		}

		//rotationY.transformType=5;
		__proto.initRotationZSprite3D=function(){
			this.rotationZ=this.rotationSprite3D.addChild(new PixelLineSprite3D(64));
			this.drawAxisZCircle(this.rotationZ,0.5,this.color);
			var lm=new DepthCullLineMaterial();
			lm.color=this.colorZ;
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			this.rotationZ.pixelLineRenderer.sharedMaterial=lm;
			this.rotationZ.name='RotationZ';
		}

		//rotationZ.transformType=6;
		__proto.initScaleXSprite3D=function(){
			this.scalingX=this.scaleSprite3D.addChild(new Sprite3D());
			var line=this.scalingX.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='ScaleX';
			var cone=this.scalingX.addChild(new MeshSprite3D(new BoxMesh(0.05,0.05,0.05)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.color;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='ScaleX';
			this.scalingX.transform.rotate(new Vector3$1(0,0,-90),true,false);
		}

		__proto.initScaleYSprite3D=function(){
			this.scalingY=this.scaleSprite3D.addChild(new Sprite3D());
			var line=this.scalingY.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='ScaleY';
			var cone=this.scalingY.addChild(new MeshSprite3D(new BoxMesh(0.05,0.05,0.05)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.color;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='ScaleY';
		}

		//cone.transformType=8;
		__proto.initScaleZSprite3D=function(){
			this.scalingZ=this.scaleSprite3D.addChild(new Sprite3D());
			var line=this.scalingZ.addChild(new PixelLineSprite3D(2));
			line.addLine(new Vector3$1(0,0,0),new Vector3$1(0,0.5,0),this.color,this.color);
			var lm=new PixelLineMaterial();
			lm.renderQueue=5000;
			lm.getRenderState(0).depthTest=0x0207;
			line.pixelLineRenderer.sharedMaterial=lm;
			line.name='ScaleZ';
			var cone=this.scalingZ.addChild(new MeshSprite3D(new BoxMesh(0.05,0.05,0.05)));
			cone.transform.localPosition=new Vector3$1(0,0.5,0);
			var mat=new GizmoMaterial();
			mat.color=this.color;
			mat.renderQueue=5000;
			mat.getRenderState(0).depthTest=0x0207;
			cone.meshRenderer.sharedMaterial=mat;
			cone.name='ScaleZ';
			this.scalingZ.transform.rotate(new Vector3$1(90,0,0),true,false);
		}

		__proto.onSelectChangeColor=function(sprite,color){
			if (color==null){
				color=this.selectColor;
			}
			if ((sprite instanceof laya.d3.core.pixelLine.PixelLineSprite3D )){
				var mat1=(sprite).pixelLineRenderer.sharedMaterial;
				mat1.color=color;
			}
			if ((sprite instanceof laya.d3.core.MeshSprite3D )){
				var mat2=(sprite).meshRenderer.sharedMaterial;
				mat2.color=color;
			}
			for (var i=0;i < sprite.numChildren;i++){
				this.onSelectChangeColor(sprite.getChildAt(i),color);
			}
		}

		__proto.reFresh=function(){
			this.onSelectChangeColor(this.positionX,this.colorX);
			this.onSelectChangeColor(this.positionY,this.colorY);
			this.onSelectChangeColor(this.positionZ,this.colorZ);
			this.onSelectChangeColor(this.rotationX,this.colorX);
			this.onSelectChangeColor(this.rotationY,this.colorY);
			this.onSelectChangeColor(this.rotationZ,this.colorZ);
			this.onSelectChangeColor(this.scalingX,this.colorX);
			this.onSelectChangeColor(this.scalingY,this.colorY);
			this.onSelectChangeColor(this.scalingZ,this.colorZ);
		}

		__proto.drawAxisXCircle=function(line,radius,circleColor,lineCount){
			(lineCount===void 0)&& (lineCount=60);
			var perAngle=(Math.PI *2.0)/ lineCount;
			var curAngle=0;
			var lasePosition=new Vector3$1(0,0,radius);
			var curPosition=new Vector3$1();
			for (var i=0;i <=lineCount;i++){
				curAngle=i *perAngle;
				curPosition.x=0;
				curPosition.y=Math.sin(curAngle)*radius;
				curPosition.z=Math.cos(curAngle)*radius;
				line.addLine(lasePosition,curPosition,circleColor,circleColor);
				curPosition.cloneTo(lasePosition);
			}
		}

		__proto.drawAxisYCircle=function(line,radius,circleColor,lineCount){
			(lineCount===void 0)&& (lineCount=60);
			var perAngle=(Math.PI *2.0)/ lineCount;
			var curAngle=0;
			var lasePosition=new Vector3$1(radius,0,0);
			var curPosition=new Vector3$1();
			for (var i=0;i <=lineCount;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*radius;
				curPosition.y=0;
				curPosition.z=Math.sin(curAngle)*radius;
				line.addLine(lasePosition,curPosition,circleColor,circleColor);
				curPosition.cloneTo(lasePosition);
			}
		}

		__proto.drawAxisZCircle=function(line,radius,circleColor,lineCount){
			(lineCount===void 0)&& (lineCount=60);
			var perAngle=(Math.PI *2.0)/ lineCount;
			var curAngle=0;
			var lasePosition=new Vector3$1(radius,0,0);
			var curPosition=new Vector3$1();
			for (var i=0;i <=lineCount;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*radius;
				curPosition.y=Math.sin(curAngle)*radius;
				curPosition.z=0;
				line.addLine(lasePosition,curPosition,circleColor,circleColor);
				curPosition.cloneTo(lasePosition);
			}
		}

		return TransformSprite3D;
	})(Sprite3D)


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.material.DepthCullLineMaterial extends laya.d3.core.material.BaseMaterial
	var DepthCullLineMaterial=(function(_super){
		function DepthCullLineMaterial(){
			DepthCullLineMaterial.__super.call(this,1);
			this.setShaderName("DepthCullLine");
			var renderState=this.getRenderState(0);
			renderState.blend=1;
			renderState.srcBlend=0x0302;
			renderState.dstBlend=0x0303;
			this._shaderValues.setVector(1,new Vector4$1(1.0,1.0,1.0,1.0));
		}

		__class(DepthCullLineMaterial,'laya.d3Editor.material.DepthCullLineMaterial',_super);
		var __proto=DepthCullLineMaterial.prototype;
		/**
		*设置颜色。
		*@param value 颜色。
		*/
		/**
		*获取颜色。
		*@return 颜色。
		*/
		__getset(0,__proto,'color',function(){
			return this._shaderValues.getVector(1);
			},function(value){
			this._shaderValues.setVector(1,value);
		});

		DepthCullLineMaterial.initShader=function(){
			var attributeMap={
				'a_Position':0
			};
			var uniformMap={
				'u_MvpMatrix':[Sprite3D.MVPMATRIX,2],
				'u_CameraPos':[0,3],
				'u_Color':[ 1,1]
			};
			var vs="attribute vec4 a_Position;\nattribute vec4 a_Color;\n\nuniform mat4 u_MvpMatrix;\n\nvarying vec4 v_Color;\n\nvarying float depthValue;\n\nvoid main()\n{\n	gl_Position = u_MvpMatrix * a_Position;\n	\n	vec4 position = u_MvpMatrix * vec4(0.0,0.0,0.0,1.0);\n	\n	depthValue = (position.z / position.w) / 2.0 + 0.5;\n	\n	v_Color = a_Color;\n}";
			var ps="#ifdef FSHIGHPRECISION\n	precision highp float;\n#else\n	precision mediump float;\n#endif\n\nuniform vec4 u_Color;\n\nvarying vec4 v_Color;\nvarying float depthValue;\n\n\nvoid main()\n{\n	gl_FragColor.rgb = v_Color.rgb * u_Color.rgb; \n	\n	if(gl_FragCoord.z > depthValue){\n		gl_FragColor.a = u_Color.a;\n	}\n	else{\n		gl_FragColor.a = 1.0;\n	}\n}";
			var gizmoShader=Shader3D.add("DepthCullLine",attributeMap,uniformMap);
			gizmoShader.addShaderPass(vs,ps);
		}

		DepthCullLineMaterial.COLOR=1;
		__static(DepthCullLineMaterial,
		['defaultMaterial',function(){return this.defaultMaterial=new DepthCullLineMaterial();}
		]);
		return DepthCullLineMaterial;
	})(BaseMaterial)


	/**
	*<code>GizmoMaterial</code> 类用于材质。
	*/
	//class laya.d3Editor.material.GizmoMaterial extends laya.d3.core.material.BaseMaterial
	var GizmoMaterial=(function(_super){
		function GizmoMaterial(){
			GizmoMaterial.__super.call(this,1);
			this.setShaderName("Gizmo");
			this._shaderValues.setVector(1,new Vector4$1(1.0,1.0,1.0,1.0));
		}

		__class(GizmoMaterial,'laya.d3Editor.material.GizmoMaterial',_super);
		var __proto=GizmoMaterial.prototype;
		/**
		*设置颜色。
		*@param value 颜色。
		*/
		/**
		*获取颜色。
		*@return 颜色。
		*/
		__getset(0,__proto,'color',function(){
			return this._shaderValues.getVector(1);
			},function(value){
			this._shaderValues.setVector(1,value);
		});

		GizmoMaterial.initShader=function(){
			var attributeMap={
				'a_Position':0,
				'a_Normal':3
			};
			var uniformMap={
				'u_MvpMatrix':[Sprite3D.MVPMATRIX,2],
				'u_WorldMat':[Sprite3D.WORLDMATRIX,2],
				'u_CameraPos':[0,3],
				'u_Color':[ 1,1]
			};
			var vs="attribute vec4 a_Position;\nattribute vec3 a_Normal;\n\nuniform vec3 u_CameraPos;\nuniform mat4 u_MvpMatrix;\nuniform mat4 u_WorldMat;\n\nvarying vec3 v_PositionWorld;\nvarying vec3 v_ViewDir;\nvarying vec3 v_Normal;\n\nmat3 inverse(mat3 m) {\n  float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n  float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n  float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n  float b01 = a22 * a11 - a12 * a21;\n  float b11 = -a22 * a10 + a12 * a20;\n  float b21 = a21 * a10 - a11 * a20;\n\n  float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n  return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n              b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n              b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nvoid main()\n{\n	gl_Position = u_MvpMatrix * a_Position;\n	\n	v_PositionWorld = (u_WorldMat * a_Position).xyz;\n	\n	v_ViewDir = u_CameraPos - v_PositionWorld;\n	v_Normal =  a_Normal * inverse(mat3(u_WorldMat));\n}";
			var ps="#ifdef FSHIGHPRECISION\n	precision highp float;\n#else\n	precision mediump float;\n#endif\n\nuniform vec4 u_Color;\n\nvarying vec3 v_ViewDir;\nvarying vec3 v_Normal;\n\nvoid main()\n{\n	float vn = max (0.0, dot (v_ViewDir, v_Normal));\n	gl_FragColor = u_Color * vn * 0.3;\n}";
			var gizmoShader=Shader3D.add("Gizmo",attributeMap,uniformMap);
			gizmoShader.addShaderPass(vs,ps);
		}

		GizmoMaterial.COLOR=1;
		return GizmoMaterial;
	})(BaseMaterial)


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.shape.BoxShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var BoxShapeLine3D=(function(_super){
		function BoxShapeLine3D(long,height,width){
			this._long=NaN;
			this._width=NaN;
			this._height=NaN;
			this.color=Color.GREEN;
			this.startPosition=new Vector3$1();
			this.endPosition=new Vector3$1();
			(long===void 0)&& (long=10);
			(height===void 0)&& (height=10);
			(width===void 0)&& (width=10);
			BoxShapeLine3D.__super.call(this,12);
			this._long=long;
			this._height=height;
			this._width=width;
			this.reCreateShape();
		}

		__class(BoxShapeLine3D,'laya.d3Editor.shape.BoxShapeLine3D',_super);
		var __proto=BoxShapeLine3D.prototype;
		__proto.reCreateShape=function(){
			this.lineCount=0;
			var staPose=this.startPosition.elements;
			var endPose=this.endPosition.elements;
			staPose[0]=-this.long/2;staPose[1]=this.height/2;staPose[2]=this.width/2;
			endPose[0]=-this.long/2;endPose[1]=this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=-this.long/2;staPose[1]=this.height/2;staPose[2]=-this.width/2;
			endPose[0]=this.long/2;endPose[1]=this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=this.height/2;staPose[2]=-this.width/2;
			endPose[0]=this.long/2;endPose[1]=this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=this.height/2;staPose[2]=this.width/2;
			endPose[0]=-this.long/2;endPose[1]=this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=-this.long/2;staPose[1]=-this.height/2;staPose[2]=this.width/2;
			endPose[0]=-this.long/2;endPose[1]=-this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=-this.long/2;staPose[1]=-this.height/2;staPose[2]=-this.width/2;
			endPose[0]=this.long/2;endPose[1]=-this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=-this.height/2;staPose[2]=-this.width/2;
			endPose[0]=this.long/2;endPose[1]=-this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=-this.height/2;staPose[2]=this.width/2;
			endPose[0]=-this.long/2;endPose[1]=-this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=-this.long/2;staPose[1]=this.height/2;staPose[2]=this.width/2;
			endPose[0]=-this.long/2;endPose[1]=-this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=-this.long/2;staPose[1]=this.height/2;staPose[2]=-this.width/2;
			endPose[0]=-this.long/2;endPose[1]=-this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=this.height/2;staPose[2]=-this.width/2;
			endPose[0]=this.long/2;endPose[1]=-this.height/2;endPose[2]=-this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
			staPose[0]=this.long/2;staPose[1]=this.height/2;staPose[2]=this.width/2;
			endPose[0]=this.long/2;endPose[1]=-this.height/2;endPose[2]=this.width/2;
			this.addLine(this.startPosition,this.endPosition,this.color,this.color);
		}

		/**
		*设置长度
		*@param value 长度
		*/
		/**
		*返回长度
		*@return 长
		*/
		__getset(0,__proto,'long',function(){
			return this._long;
			},function(value){
			if (this._long!==value){
				this._long=value;
				this.reCreateShape();
			}
		});

		/**
		*设置宽度
		*@param value 宽度
		*/
		/**
		*返回宽度
		*@return 宽
		*/
		__getset(0,__proto,'width',function(){
			return this._width;
			},function(value){
			if (this._width!==value){
				this._width=value;
				this.reCreateShape();
			}
		});

		/**
		*设置高度
		*@param value 高度
		*/
		/**
		*返回高度
		*@return 高
		*/
		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			if (this._height!==value){
				this._height=value;
				this.reCreateShape();
			}
		});

		return BoxShapeLine3D;
	})(PixelLineSprite3D)


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.shape.CapsuleShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var CapsuleShapeLine3D=(function(_super){
		function CapsuleShapeLine3D(radius,height){
			this._radius=NaN;
			this._height=NaN;
			this.color=Color.GREEN;
			(radius===void 0)&& (radius=0.5);
			(height===void 0)&& (height=2);
			CapsuleShapeLine3D.__super.call(this,260);
			this._radius=radius;
			this._height=height < radius *2 ? radius *2 :height;
			this.reCreateShape();
		}

		__class(CapsuleShapeLine3D,'laya.d3Editor.shape.CapsuleShapeLine3D',_super);
		var __proto=CapsuleShapeLine3D.prototype;
		__proto.reCreateShape=function(){
			this.lineCount=0;
			var lasePosition;
			var i=0;
			var perAngle=(Math.PI *2.0)/ 63;
			var curAngle=0;
			lasePosition=new Vector3$1(0,(this.height-this.radius *2)/ 2,this.radius);
			var curPosition=new Vector3$1();
			for (i=0;i < 32;i++){
				curAngle=i *perAngle;
				curPosition.x=0;
				curPosition.y=Math.sin(curAngle)*this.radius+(this.height-this.radius *2)/ 2;
				curPosition.z=Math.cos(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curPosition=new Vector3$1(0,-(this.height-this.radius *2)/ 2,-this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			curPosition.cloneTo(lasePosition);
			for (i=0;i < 32;i++){
				curAngle=i *perAngle;
				curPosition.x=0;
				curPosition.y=Math.sin(Math.PI+curAngle)*this.radius-(this.height-this.radius *2)/ 2;
				curPosition.z=Math.cos(Math.PI+curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curPosition=new Vector3$1(0,(this.height-this.radius *2)/ 2,this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(this.radius,(this.height-this.radius *2)/ 2,0);
			for (i=0;i < 32;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=Math.sin(curAngle)*this.radius+(this.height-this.radius *2)/ 2;
				curPosition.z=0;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curPosition=new Vector3$1(-this.radius,-(this.height-this.radius *2)/ 2,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			curPosition.cloneTo(lasePosition);
			for (i=0;i < 32;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(Math.PI+curAngle)*this.radius;
				curPosition.y=Math.sin(Math.PI+curAngle)*this.radius-(this.height-this.radius *2)/ 2;
				curPosition.z=0;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curPosition=new Vector3$1(this.radius,(this.height-this.radius *2)/ 2,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(this.radius,(this.height-this.radius *2)/ 2,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=(this.height-this.radius *2)/ 2;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			lasePosition=new Vector3$1(this.radius,-(this.height-this.radius *2)/ 2,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=-(this.height-this.radius *2)/ 2;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
		}

		/**
		*设置半径（改变此属性会重新生成顶点和索引）
		*@param value 半径
		*/
		/**
		*返回半径
		*@return 半径
		*/
		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			if (this._radius!==value){
				this._radius=value;
				this.reCreateShape();
			}
		});

		/**
		*设置高度（改变此属性会重新生成顶点和索引）
		*@param value 高度
		*/
		/**
		*返回高度
		*@return 高度
		*/
		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			if (this._height!==value){
				this._height=value;
				this.reCreateShape();
			}
		});

		return CapsuleShapeLine3D;
	})(PixelLineSprite3D)


	/**
	*圆锥
	*@author zyh
	*/
	//class laya.d3Editor.shape.ConeShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var ConeShapeLine3D=(function(_super){
		function ConeShapeLine3D(radius,height){
			this._radius=NaN;
			this._height=NaN;
			this.color=Color.GREEN;
			(radius===void 0)&& (radius=0.5);
			(height===void 0)&& (height=1);
			ConeShapeLine3D.__super.call(this,68);
			this._radius=radius;
			this._height=height < radius *2 ? radius *2 :height;
			this.reCreateShape();
		}

		__class(ConeShapeLine3D,'laya.d3Editor.shape.ConeShapeLine3D',_super);
		var __proto=ConeShapeLine3D.prototype;
		__proto.reCreateShape=function(){
			this.lineCount=0;
			var perAngle=(Math.PI *2.0)/ 63;
			var curAngle=0;
			var _h=this.height / 2;
			var lasePosition=new Vector3$1(0,_h,0);
			var curPosition=new Vector3$1(0,-_h,this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			curPosition=new Vector3$1(this.radius,-_h,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			curPosition=new Vector3$1(-this.radius,-_h,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			curPosition=new Vector3$1(0,-_h,-this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(this.radius,-_h ,0);
			for (var i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=-_h;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
		}

		/**
		*设置半径（改变此属性会重新生成顶点和索引）
		*@param value 半径
		*/
		/**
		*返回半径
		*@return 半径
		*/
		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			if (this._radius!==value){
				this._radius=value;
				this.reCreateShape();
			}
		});

		/**
		*设置高度（改变此属性会重新生成顶点和索引）
		*@param value 高度
		*/
		/**
		*返回高度
		*@return 高度
		*/
		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			if (this._height!==value){
				this._height=value;
				this.reCreateShape();
			}
		});

		return ConeShapeLine3D;
	})(PixelLineSprite3D)


	/**
	*...
	*@author zyh
	*/
	//class laya.d3Editor.shape.CylinderShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var CylinderShapeLine3D=(function(_super){
		function CylinderShapeLine3D(radius,height){
			this._radius=NaN;
			this._height=NaN;
			this.color=Color.GREEN;
			(radius===void 0)&& (radius=0.5);
			(height===void 0)&& (height=2);
			CylinderShapeLine3D.__super.call(this,132);
			this._radius=radius;
			this._height=height < radius *2 ? radius *2 :height;
			this.reCreateShape();
		}

		__class(CylinderShapeLine3D,'laya.d3Editor.shape.CylinderShapeLine3D',_super);
		var __proto=CylinderShapeLine3D.prototype;
		__proto.reCreateShape=function(){
			this.lineCount=0;
			var i=0;
			var perAngle=(Math.PI *2.0)/ 63;
			var curAngle=0;
			var _h=this.height / 2;
			var lasePosition=new Vector3$1(0,-_h,this.radius);
			var curPosition=new Vector3$1(0,_h,this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(this.radius,-_h,0);
			curPosition=new Vector3$1(this.radius,_h,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(-this.radius,-_h,0);
			curPosition=new Vector3$1(-this.radius,_h,0);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(0,-_h,-this.radius);
			curPosition=new Vector3$1(0,_h,-this.radius);
			this.addLine(lasePosition,curPosition,this.color,this.color);
			lasePosition=new Vector3$1(this.radius,_h,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=_h;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			lasePosition=new Vector3$1(this.radius,-_h,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=-_h;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
		}

		/**
		*设置半径（改变此属性会重新生成顶点和索引）
		*@param value 半径
		*/
		/**
		*返回半径
		*@return 半径
		*/
		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			if (this._radius!==value){
				this._radius=value;
				this.reCreateShape();
			}
		});

		/**
		*设置高度（改变此属性会重新生成顶点和索引）
		*@param value 高度
		*/
		/**
		*返回高度
		*@return 高度
		*/
		__getset(0,__proto,'height',function(){
			return this._height;
			},function(value){
			if (this._height!==value){
				this._height=value;
				this.reCreateShape();
			}
		});

		return CylinderShapeLine3D;
	})(PixelLineSprite3D)


	/**
	*...
	*@author zyh
	*/
	//class laya.d3Editor.shape.MeshShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var MeshShapeLine3D=(function(_super){
		function MeshShapeLine3D(count){
			this._mesh=null;
			this.color=Color.GREEN;
			this.vertex1=new Vector3$1();
			this.vertex2=new Vector3$1();
			this.vertex3=new Vector3$1();
			MeshShapeLine3D.__super.call(this,count);
		}

		__class(MeshShapeLine3D,'laya.d3Editor.shape.MeshShapeLine3D',_super);
		var __proto=MeshShapeLine3D.prototype;
		__proto.reCreateShape=function(e){
			this.lineCount=0;
			var mesh=e;
			var vbBuffer=mesh._vertexBuffers ? mesh._vertexBuffers[0] :(mesh)._primitveGeometry._vertexBuffer;
			var vbBufferData=vbBuffer.getData();
			var ibBufferData=mesh._indexBuffer ? mesh._indexBuffer.getData():(mesh)._primitveGeometry._indexBuffer.getData();
			var vertexStrideCount=vbBuffer.vertexDeclaration.vertexStride / 4;
			var loopCount=0;
			var index=0;
			for (var i=0;i < ibBufferData.length;i+=3){
				loopCount=0;
				index=0;
				this.vertex1.x=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex1.y=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex1.z=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				loopCount++;
				index=0;
				this.vertex2.x=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex2.y=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex2.z=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				loopCount++;
				index=0;
				this.vertex3.x=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex3.y=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				this.vertex3.z=vbBufferData[ibBufferData[i+loopCount] *vertexStrideCount+index++];
				loopCount++;
				this.addLine(this.vertex1,this.vertex2,this.color,this.color);
				this.addLine(this.vertex2,this.vertex3,this.color,this.color);
				this.addLine(this.vertex3,this.vertex1,this.color,this.color);
			}
		}

		__getset(0,__proto,'mesh',function(){
			return this._mesh;
			},function(value){
			this._mesh=value;
			this.reCreateShape(Laya.loader.getRes(IDEAPIS.assetsPath+'/'+value));
		});

		return MeshShapeLine3D;
	})(PixelLineSprite3D)


	/**
	*...
	*@author
	*/
	//class laya.d3Editor.shape.SphereShapeLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
	var SphereShapeLine3D=(function(_super){
		function SphereShapeLine3D(radius,camera){
			this.curCamera=null;
			this.circleBillBoard=null;
			this._radius=NaN;
			this.color=Color.GREEN;
			this._mat=new Matrix4x4$1();
			this._position=new Vector3$1();
			this._rotation=new Quaternion$1();
			this._scale=new Vector3$1();
			(radius===void 0)&& (radius=0.5);
			SphereShapeLine3D.__super.call(this,192);
			this._radius=radius;
			this.reCreateShape();
		}

		__class(SphereShapeLine3D,'laya.d3Editor.shape.SphereShapeLine3D',_super);
		var __proto=SphereShapeLine3D.prototype;
		__proto.reCreateShape=function(){
			this.lineCount=0;
			var i=0;
			var perAngle=(Math.PI *2.0)/ 63;
			var curAngle=0;
			var lasePosition=new Vector3$1(0,0,this.radius);
			var curPosition=new Vector3$1();
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=0;
				curPosition.y=Math.sin(curAngle)*this.radius;
				curPosition.z=Math.cos(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curAngle=0;
			lasePosition=new Vector3$1(this.radius,0,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=0;
				curPosition.z=Math.sin(curAngle)*this.radius;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
			curAngle=0;
			lasePosition=new Vector3$1(this.radius,0,0);
			for (i=0;i < 64;i++){
				curAngle=i *perAngle;
				curPosition.x=Math.cos(curAngle)*this.radius;
				curPosition.y=Math.sin(curAngle)*this.radius;
				curPosition.z=0;
				this.addLine(lasePosition,curPosition,this.color,this.color);
				curPosition.cloneTo(lasePosition);
			}
		}

		/**
		*设置半径（改变此属性会重新生成顶点和索引）
		*@param value 半径
		*/
		/**
		*返回半径
		*@return 半径
		*/
		__getset(0,__proto,'radius',function(){
			return this._radius;
			},function(value){
			if (this._radius!==value){
				this._radius=value;
				this.reCreateShape();
			}
		});

		return SphereShapeLine3D;
	})(PixelLineSprite3D)



})(window,document,Laya);
